﻿<Window x:Class="LockCrypt.WinCreateDatabase"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:lex="http://schemas.root-project.org/xaml/presentation"
    xmlns:loc="clr-namespace:LockCrypt"
    xmlns:l49loc="clr-namespace:Lime49.UI"
    xmlns:l49="clr-namespace:Lime49;assembly=Lime49"
    Title="{lex:LocText LockCrypt.Core:Strings:CreateDatabase}" Style="{StaticResource {x:Type Window}}" Icon="/LockCrypt;component/Resources/LockCrypt.ico"
    Height="380" Width="400" MinHeight="200" MinWidth="350" SizeToContent="Height"
    WindowStartupLocation="CenterOwner" x:Name="root"
    l49:WindowService.EscapeClosesWindow="True">
    <Window.CommandBindings>
        <CommandBinding Command="ApplicationCommands.New" Executed="CreateDatabase" />
        <CommandBinding Command="ApplicationCommands.Close" Executed="CloseWindow" />
    </Window.CommandBindings>
    <DockPanel Margin="6" Grid.IsSharedSizeScope="True">
        <loc:DatabaseSelector x:Name="dbSelector" DockPanel.Dock="Top" DatabaseMode="XML" EncryptionAlgorithm="Aes256" TabIndex="1" DatabasePathChanged="dbSelector_PathChanged" />
        <GroupBox DockPanel.Dock="Top" Header="{lex:LocText LockCrypt.Core:Strings:Options}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="labels"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                
                <CheckBox Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" x:Name="chkOpenNow" TabIndex="2" Content="{lex:LocText LockCrypt.Core:Strings:OpenNow}" IsChecked="true"/>
                <CheckBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" x:Name="chkOpenOnStartup" TabIndex="3" DockPanel.Dock="Top" Content="{lex:LocText LockCrypt.Core:Strings:OpenOnStartup}" Checked="ToggleOpenOnStartup" Unchecked="ToggleOpenOnStartup"/>
                <CheckBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name="chkGenerateDescriptor" TabIndex="4" DockPanel.Dock="Top" Content="{lex:LocText LockCrypt.Core:Strings:SaveDatabaseDescriptor}" IsChecked="True" />
                
                <l49loc:FilePicker Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3" x:Name="descriptorPathChooser" IsEnabled="{Binding IsChecked,ElementName=chkGenerateDescriptor,Mode=OneWay}"
                                LabelText="{lex:LocText LockCrypt.Core:Strings:SaveDescriptorAs}"
                                PathHistoryKey="{x:Null}"
                                IsSaveDialog="true"
                                DialogTitle="{lex:LocText LockCrypt.Core:Strings:SaveDescriptorAs}"/>
            </Grid>
        </GroupBox>
        
        <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button x:Name="btnExport" IsDefault="True" HorizontalAlignment="Right" MinWidth="70" Command="ApplicationCommands.New" Content="{lex:LocText LockCrypt.Core:Strings:Create}"/>
            <Button x:Name="btnCancel" HorizontalAlignment="Right" MinWidth="70" IsCancel="True" Command="ApplicationCommands.Close" Content="{lex:LocText LockCrypt.Core:Strings:Cancel}"/>
        </StackPanel>
    </DockPanel>
</Window>
